<template>
  <div>
    首页

    <a>{{ $t("message.title") }}</a>
    <p @click="language()">切换</p>
  </div>
</template>
<script>
export default {
  name: "Home",
  data() {
    return {};
  },
  methods: {
    language() {
      if (localStorage.getItem("locale") === "en") {
        localStorage.setItem("locale", "zh");
        this.$i18n.locale = localStorage.getItem("locale");
      } else {
        localStorage.setItem("locale", "en");
        this.$i18n.locale = localStorage.getItem("locale");
      }
    }
  }
};
</script>
